<template>
  <div class="wallpaper_box">
    <ul class="wallpaper_list">
      <li v-for="item in list" :key="item.id">
        <p @click="innerPage(item.id)"><img v-lazy="item.cover_img" :alt="item.title"></p>
        <TipTools :picInfo="item">
            <div slot="tips_left" class="tips_left">
                <p class="tips_title">{{ item.title }}</p>
            </div>
        </TipTools>
      </li>
    </ul>
  </div>
</template>

<script>
import TipTools from '@/components/TipTools.vue'
export default {
  name: 'Index',
  data () {
    return {
      list : [],
      page : 1,
      isLoadShow : true,
      loading : false,
      loaded : false
    }
  },
  mounted() {
    this.getHot();
  },
  methods : {
    getHot () {
      this.$axios.get('http://localhost:3000/getHot')
      .then((res) => {
        this.list = res.data.data
      })
      .catch((err) => {
        console.error(err);
      })
    },
    innerPage(id) {
      this.$router.push({name: 'Article', params: {id: id}})
    }
  },
  components: {
    TipTools
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.wallpaper_box{
  background-color: #001c2d;
  padding-top: 45px;
  padding-bottom: 38px;
  padding-left: 8px;
  padding-right: 8px;
}

.wallpaper_list{
  margin: 0;
  padding: 0;
  text-align: center;
  list-style-type: none;
}
.wallpaper_list li{
  width: 100%;
  margin: 0 auto;
  margin-top: 8px;
}

.wallpaper_list li img{
  display: block;
  width: 100%;
  border-top-right-radius: 5px;
  border-top-left-radius: 5px;
  -moz-border-top-right-radius: 5px;
  -moz-border-top-left-radius: 5px;
  -webkit-border-top-right-radius: 5px;
  -webkit-border-top-left-radius: 5px;
}

.wallpaper_list li img[lazy=loading] {
  width: 100%;
  height: 222px;
  margin: auto;
  background-size: cover;
}

.wallpaper_list_loading {
  text-align: center;
  height: 50px;
  line-height: 50px;
  padding-top: 12px;
}

.wallpaper_list_loaded {
  text-align: center;
  height: 50px;
  line-height: 50px;
  font-size: 12px;
  color: #999;
}

.wallpaper_list_loading div {
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
}
</style>
